package com.gopay.common.log.util;

import com.gopay.common.log.constants.LogCategoryCd;
import com.gopay.common.log.constants.LogOTUserCd;
import com.gopay.common.log.constants.LogOperStatusCd;
import com.gopay.common.log.constants.LogPlatformCd;

/**
 * 日志翻译工具类
 * 
 * @LogTranslateUtil.java
 * @author dak.wang
 * @2016年4月19日 上午9:23:31 www.gopay.com.cn Inc.All rights reserved.
 */
public class LogTranslateUtil {

    /**
     * 获取日志平台名称
     * 
     * @param platformCd
     * @return
     */
    public static String getPlatformName(String platformCd) {
        String platformName = "";
        if (LogPlatformCd.CONSOLE.value.equals(platformCd)) {
            platformName = "CONSOLE";
        } else if (LogPlatformCd.PORTAL.value.equals(platformCd)) {
            platformName = "PORTAL";
        } else if (LogPlatformCd.CPS.value.equals(platformCd)) {
            platformName = "CPS";
        } else if (LogPlatformCd.CASHIER.value.equals(platformCd)) {
            platformName = "CASHIER";
        } else if (LogPlatformCd.DPS.value.equals(platformCd)) {
            platformName = "DPS";//add  by zhoupeng 2016-11-18
        } else {
            platformName = "未知";
        }
        return platformName;
    }

    /**
     * 获取日志目录名称
     * 
     * @param categoryCd
     * @return
     */
    public static String getLogCategoryName(String categoryCd) {
        String categoryName = "";
        if (LogCategoryCd.ORDER.value.equals(categoryCd)) {
            categoryName = "订单";
        } else if (LogCategoryCd.USER.value.equals(categoryCd)) {
            categoryName = "用户";
        } else if (LogCategoryCd.CONFIG.value.equals(categoryCd)) {
            categoryName = "配置";
        } else if (LogCategoryCd.AUTH.value.equals(categoryCd)) {
            categoryName = "权限";
        } else if (LogCategoryCd.RISK.value.equals(categoryCd)) {
            categoryName = "风控";
        } else if (LogCategoryCd.SETTLE.value.equals(categoryCd)) {
        	categoryName = "结算";
        } else if (LogCategoryCd.TRANSFER.value.equals(categoryCd)) {
        	categoryName = "交易";//add by zhoupeng 2016-11-24
        } else {
            categoryName = "未知";
        }
        return categoryName;
    }

    /**
     * 获取操作状态名称
     * 
     * @param operStatusCd
     * @return
     */
    public static String getOperStatusName(String operStatusCd) {
        String operStatusName = "";
        if (LogOperStatusCd.SUCCESS.value.equals(operStatusCd)) {
            operStatusName = "成功";
        } else if (LogOperStatusCd.FAILED.value.equals(operStatusCd)) {
            operStatusName = "失败";
        } else if (LogOperStatusCd.ROLLBACK.value.equals(operStatusCd)) {
            operStatusName = "回滚";
        } else {
            operStatusName = "未知";
        }
        return operStatusName;
    }

    /**
     * 获取日志用户操作类型名称
     * 
     * @param oTUserCd
     * @return
     */
    public static String getOTUserName(String oTUserCd) {
        String oTUserName = "";
        if (LogOTUserCd.FIND_LOGIN_PWD.value.equals(oTUserCd)) {
            oTUserName = "找回登录密码";
        } else if (LogOTUserCd.MODIFY_LOGIN_QUES.value.equals(oTUserCd)) {
            oTUserName = "修改登录密码";
        } else if (LogOTUserCd.MODIFY_LOGIN_QUES.value.equals(oTUserCd)) {
            oTUserName = "修改登录安全问题";
        } else if (LogOTUserCd.RESET_PAY_PWD.value.equals(oTUserCd)) {
            oTUserName = "重置支付密码";
        } else if (LogOTUserCd.MODIFY_PAY_QUES.value.equals(oTUserCd)) {
            oTUserName = "修改支付安全问题";
        } else if (LogOTUserCd.FIND_PAY_PWD.value.equals(oTUserCd)) {
            oTUserName = "找回支付密码";
        } else if (LogOTUserCd.MODIFY_PAY_NOTIFY_ADDR.value.equals(oTUserCd)) {
            oTUserName = "设置付款通知地址";
        } else if (LogOTUserCd.MODIFY_MER_VERIFY_CODE.value.equals(oTUserCd)) {
            oTUserName = "设置商户识别码";
        } else if (LogOTUserCd.ADD_OPERATOR.value.equals(oTUserCd)) {
            oTUserName = "添加操作员";
        } else if (LogOTUserCd.MODIFY_OPERATOR.value.equals(oTUserCd)) {
            oTUserName = "修改操作员";
        } else if (LogOTUserCd.LOCK_OPERATOR.value.equals(oTUserCd)) {
            oTUserName = "锁定操作员";
        } else if (LogOTUserCd.DEL_OPERATOR.value.equals(oTUserCd)) {
            oTUserName = "删除操作员";
        } else if (LogOTUserCd.MODIFY_RESERVED_INFO.value.equals(oTUserCd)) {
            oTUserName = "修改预留信息";
        } else if (LogOTUserCd.MODIFY_PAY_PWD.value.equals(oTUserCd)) {
            oTUserName = "修改支付密码";
        } else if (LogOTUserCd.FILL_INFO.value.equals(oTUserCd)) {
            oTUserName = "补全信息";
        } else if (LogOTUserCd.LOGIN.value.equals(oTUserCd)) {
            oTUserName = "用户登陆";//(DPS暂时加上，17年1月合并的时候用主干红文写的login)
        } else if (LogOTUserCd.PERSON_CERT_DPS.value.equals(oTUserCd)) {
            oTUserName = "个人实名认证";//add  by zhoupeng 2016-11-18
        } else if (LogOTUserCd.GO_PAY_DPS.value.equals(oTUserCd)) {
            oTUserName = "支付";//add  by zhoupeng 2016-11-18
        }else {
            oTUserName = "未知";
        }
        return oTUserName;
    }
}
